/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package client.communication;

import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.log4j.Logger;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

/**
 *
 * @author 
 */
public class CSAXParserClient {
    //attributen
    private SAXParser parser;
    private CSAXDefaultHandlerClient handler;
    private Logger logger = Logger.getLogger(CSAXParserClient.class);
    
    public CSAXParserClient(){
        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            handler = new CSAXDefaultHandlerClient();
            parser = factory.newSAXParser();
        } catch (ParserConfigurationException ex) {
            logger.error(ex);
        } catch (SAXException ex) {
            logger.error(ex);
        }
    }
    
    public void parse(InputSource s){
        try {
            parser.parse(s, handler.getDefaultHandler());
        } catch (SAXException ex) {
            logger.error(ex);
        } catch (IOException ex) {
            logger.error(ex);
        }
    }

}
